const hightlight=(target:Object,methodName:string,decorator:PropertyDescriptor)=>{
    const method=decorator.value
    decorator.value=()=>{
        return `<div style="color:red">${method()}</div>`
    }
}
/**
 * 如上为装饰器工厂
 * @param times 
 * @returns 
 */
const sleepPrint=(times:number)=>{
    return (target:Object,methodName:string,decorator:PropertyDescriptor)=>{
        const method=decorator.value
        decorator.value=()=>{
            setTimeout(() => {
                method()
            }, times);
        }
    }
}
class FunctionComponent{
    @hightlight
    response(){
      return 'hello World'
    }
    @sleepPrint(50000)
    show(){
        console.log("你好世界");
    }
}
let fc=new FunctionComponent() 
//console.log(fc.response());
fc.show()
